body {
    font-family: Arial, sans-serif;
    width: 600px;
    margin: 0 auto;
    display: flex;
    box-sizing: border-box;
    overflow: hidden;
    max-height: 100vh;
}

@media (max-height: 600px) {
    body {
        max-height: 600px;
    }
}

.todo-container {
    background-color: #f5f5f5;
    padding: 20px 20px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.todo-item {
    display: flex;
    align-items: stretch;
    padding: 0;
    background-color: white;
    margin-bottom: 8px;
    border-radius: 3px;
    border-left: 4px solid #ec7e7e;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    min-height: 50px;
}

.todo-item.completed {
    background-color: #f8f8f8;
    border-left: 4px solid #4CAF50;
    opacity: 0.8;
}

.todo-item.completed .content {
    color: #666;
    text-decoration: line-through;
}

.todo-item.completed img {
    filter: grayscale(30%);
    opacity: 0.8;
}

.delete-btn {
    padding: 5px 10px;
    background-color: #ff4444;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.delete-btn:hover {
    background-color: #cc0000;
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

#todo-input {
    width: 100%;
    padding: 8px;
    min-height: 60px;
    resize: vertical;
    font-family: Arial, sans-serif;
    line-height: 1.4;
    border: 1px solid #ddd;
    border-radius: 3px;
    box-sizing: border-box;
}

#add-btn:hover {
    background-color: #388E3C;
}

.todo-item img {
    max-width: 100px;
    max-height: 100px;
    margin: 0;
    border-radius: 4px;
    cursor: pointer;
    object-fit: cover;
    vertical-align: middle;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

.todo-item img:hover {
    opacity: 0.9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transform: scale(1.02);
    transition: all 0.2s ease;
}

/* 图片预览相关样式 */
.preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.preview-modal.active {
    display: flex;
}

.preview-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    overflow: visible;
}

.preview-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    width: auto;
    height: auto;
    transition: transform 0.1s ease;
    transform-origin: center center;
    user-select: none;
    -webkit-user-drag: none;
}

.preview-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
}

.preview-nav button {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    padding: 15px 20px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: absolute;
    border-radius: 4px;
    opacity: 0;
}

.preview-modal:hover .preview-nav button {
    opacity: 1;
}

.preview-nav button {
    top: 50%;
    transform: translateY(-50%) scale(0.9);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-nav button:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.preview-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    padding: 0;
    transform: scale(0.9);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preview-modal .preview-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.preview-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
}

.edit-btn {
    margin-left: 10px;
    margin-right: 8px;
    padding: 5px 10px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.edit-btn:hover {
    background-color: #388E3C;
}

.edit-container {
    flex: 1;
    margin: 0 10px;
    display: flex;
    flex-direction: column;
}

.edit-input {
    width: 100%;
    min-height: 60px;
    padding: 8px;
    margin-bottom: 10px;
    resize: vertical;
    font-family: Arial, sans-serif;
    line-height: 1.4;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.edit-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.save-btn, .cancel-btn {
    padding: 5px 15px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.save-btn {
    background-color: #4CAF50;
    color: white;
}

.cancel-btn {
    background-color: #f44336;
    color: white;
}

.confirm-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.confirm-text {
    color: #666;
    font-size: 14px;
}

/* 修改确认按钮样式 */
.confirm-btn {
    padding: 5px 15px;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.confirm-btn:hover {
    background-color: #d32f2f;
}

/* 添加取消按钮特定样式 */
.confirm-container .cancel-btn {
    padding: 5px 15px;
    background-color: #e0e0e0;
    color: #666;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.confirm-container .cancel-btn:hover {
    background-color: #bdbdbd;
}

/* 修改按钮容器的默认状态 */
.button-container {
    display: flex;
    gap: 8px;
    margin-left: 0;
    opacity: 0;  /* 默认隐藏 */
    transition: opacity 0.2s ease;  /* 添加过渡效果 */
}

/* 修改右侧容器的样式 */
.right-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    margin-left: auto;
    padding: 12px;
}

/* 当鼠标悬停在待办事项上时显示按钮 */
.todo-item:hover .button-container {
    opacity: 1;
}

/* 确保在编辑和删除确认状态下按钮容器可见 */
.todo-item .button-container.editing,
.todo-item .button-container.confirming {
    opacity: 1;
}

/* 修改复选框容器样式 */
.todo-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    padding: 0;
    align-self: center;
    margin-left: 12px;
}

/* 修改复选框的外观 */
.todo-item input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: 2px solid #ddd;
    border-radius: 50%;
    background-color: white;
    position: relative;
    transition: all 0.2s;
}

/* 复选框选中状态的样式 */
.todo-item input[type="checkbox"]:checked,.todo-item input[type="checkbox"]:hover {
    background-color: #4CAF50;
    border-color: #4CAF50;
}

/* 添加勾选标记 */
.todo-item input[type="checkbox"]:checked::after,.todo-item input[type="checkbox"]:hover::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.control-panel {
    margin-bottom: 20px;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sort-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

/* 修改清除按钮样式 */
.clear-btn {
    flex: 1;
    padding: 10px 15px;
    background-color: #e0e0e0;
    color: #666;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 15px;
}

.clear-btn:hover {
    background-color: #bdbdbd;
}


.sort-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.sort-btn {
    padding: 5px 12px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 3px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.sort-btn:hover {
    background-color: #e9e9e9;
}

.sort-btn.active {
    background-color: #a3a5a3;
    color: white;
    border-color: #f7f7f7;
}

.sort-icon {
    font-size: 12px;
    transition: transform 0.2s;
}

.sort-btn[data-order="asc"] .sort-icon {
    transform: rotate(180deg);
}

.time-container {
    font-size: 12px;
    color: #888;
    text-align: right;
    transition: opacity 0.3s ease;
    min-height: 18px;  /* 添加最小高度 */
}

.time-label {
    margin-right: 5px;
}

.time-value {
    color: #666;
}

/* 已完成项目的时间显示样式 */
.todo-item.completed .time-container {
    opacity: 0.8;
}

.right-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    margin-left: auto;
    padding: 12px;
}

.main-content {
    flex: 1;
    padding: 12px 10px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: stretch;
}

.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

/* 修改文本节点的样式 */
.content-wrapper > div:not(:has(img)) {
    margin: 0;
    white-space: normal;  /* 允许自动换行 */
    overflow-wrap: break-word;  /* 允许长单词换行 */
    word-break: break-word;  /* 允许在任意字符间换行 */
    overflow: hidden;
    max-width: 100%;
    line-height: 1.5;
    transition: color 0.3s ease, text-decoration 0.3s ease;
}

/* 修改图片容器样式 */
.content-wrapper > div:has(img) {
    margin: 0;
    display: flex;
    align-items: center;
    flex-shrink: 0;  /* 防止图片被压缩 */
}

.main-content:hover {
    background-color: #f9f9f9;
}

.main-content > div {
    margin: 4px 0;
}

.main-content {
    min-height: unset;
}

.toggle-container {
    display: flex;
    align-items: center;
    transition: opacity 0.3s ease;
    opacity: 1 !important;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    color: #666;
}

.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 自定义复选框样式，与待办事项的复选框保持一致 */
.toggle-label input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: 2px solid #ddd;
    border-radius: 3px;
    background-color: white;
    position: relative;
    transition: all 0.2s;
}

.toggle-label input[type="checkbox"]:checked {
    background-color: #4CAF50;
    border-color: #4CAF50;
}

.toggle-label input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.confirm-dialog.active {
    opacity: 1;
}

.dialog-content {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    transform: translateY(-20px);
    transition: transform 0.2s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.confirm-dialog.active .dialog-content {
    transform: translateY(0);
}

.dialog-content h3 {
    margin: 0 0 15px 0;
    color: #333;
}

.dialog-content p {
    margin: 0 0 20px 0;
    color: #666;
}

.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.dialog-buttons .confirm-btn,
.dialog-buttons .cancel-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dialog-buttons .confirm-btn {
    background-color: #f44336;
    color: white;
}

.dialog-buttons .confirm-btn:hover {
    background-color: #d32f2f;
}

.dialog-buttons .cancel-btn {
    background-color: #e0e0e0;
    color: #666;
}

.dialog-buttons .cancel-btn:hover {
    background-color: #bdbdbd;
}

.dialog-message {
    color: #666;
    margin-bottom: 20px;
}

.todo-preview {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.5;
}

.preview-count {
    color: #666;
    display: block;
    margin-bottom: 8px;
}

.preview-text {
    color: #333;
    background-color: #f5f5f5;
    padding: 5px 10px;
    border-radius: 3px;
    margin-bottom: 5px;
    word-break: break-all;
}

.preview-more {
    color: #666;
    font-size: 13px;
    margin-top: 5px;
    font-style: italic;
}

/* 完成状态下内容的样式 */
.todo-item.completed .content-wrapper > div {
    color: #666;
    text-decoration: line-through;
}

/* 完成状态下图片的样式 */
.todo-item.completed img {
    filter: grayscale(30%);
    opacity: 0.8;
}

/* 完成状态下时间显示的样式 */
.todo-item.completed .time-container {
    opacity: 0.8;
}

.empty-message {
    text-align: center;
    padding: 40px 20px;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.3s ease;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.empty-text {
    font-size: 18px;
    color: #333;
    margin-bottom: 10px;
}

.empty-hint {
    font-size: 14px;
    color: #666;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 修改列表容器样式 */
#todo-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

/* 美化滚动条 */
#todo-list::-webkit-scrollbar {
    width: 6px;
}

#todo-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#todo-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

#todo-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.button-row {
    display: flex;
    gap: 10px;
}

#add-btn {
    flex: 2;
    padding: 10px 15px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 15px;
}

.clear-btn {
    flex: 1;
    padding: 10px 15px;
    background-color: #e0e0e0;
    color: #666;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 15px;
}

#add-btn, .clear-btn {
    width: auto;
}

.time-value.unfinished {
    color: #999;
    font-style: italic;
}

/* 修改预览模态框的按钮样式 */
.preview-modal .preview-nav button,
.preview-modal .preview-close {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    padding: 15px 20px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: absolute;
    border-radius: 4px;
    opacity: 0;
}

/* 当鼠标移入预览模态框时显示按钮 */
.preview-modal:hover .preview-nav button,
.preview-modal:hover .preview-close {
    opacity: 1;
}

/* 左右导航按钮的共同样式 */
.preview-modal .preview-nav button {
    top: 50%;
    transform: translateY(-50%) scale(0.9);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 上一张按钮 */
.preview-modal .preview-prev {
    left: 20px;
}

/* 下一张按钮 */
.preview-modal .preview-next {
    right: 20px;
}

/* 关闭按钮 */
.preview-modal .preview-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    padding: 0;
    transform: scale(0.9);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* 鼠标悬停效果 */
.preview-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

/* 图片计数器样式 */
.preview-modal .preview-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
}

/* 当按钮不可见时的样式 */
.preview-modal .preview-nav button[style*="visibility: hidden"] {
    display: none;
}

/* 添加已完成分组相关样式 */
.completed-group {
    margin-top: 20px;
    border-top: 1px solid #eee;
}

.completed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    color: #666;
    cursor: pointer;
}

.completed-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 修改清除按钮样式 */
.completed-actions .clear-btn {
    padding: 5px 10px;
    background-color: #e0e0e0;
    color: #666;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 13px;
}

.completed-actions .clear-btn:hover {
    background-color: #bdbdbd;
}

/* 修改折叠按钮样式 */
.completed-actions .toggle-completed {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.completed-actions .toggle-completed:hover {
    color: #333;
}

.completed-container {
    transition: max-height 0.3s ease;
    overflow: hidden;
}

.completed-container.collapsed {
    max-height: 0;
}

/* 修改已完成项目的样式 */
.completed-container .todo-item {
    opacity: 0.8;
    background-color: #f8f8f8;
}

/* 清除按钮不显示手型光标 */
.completed-actions .clear-btn {
    cursor: pointer;
}

/* 移除不需要的光标样式 */
.completed-title {
    cursor: inherit;
}

.toggle-completed {
    cursor: inherit;
} 
